import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Test;


public class TestAShape extends TestCase{
	CartesianPoint ca1 = new CartesianPoint(4, 3);
	CartesianPoint ca2 = new CartesianPoint(5, 12);
	CartesianPoint ca3 = new CartesianPoint(6, 8);

	ASingleShape d1 = new Dot(ca1);
	ASingleShape d2 = new Dot(ca2);
	ASingleShape d3 = new Dot(ca3);

	ASingleShape cr1 = new Circle(ca1, 5);
	ASingleShape cr2 = new Circle(ca2, 10);
	ASingleShape cr3 = new Circle(ca3, 12);

	ASingleShape s1 = new Square(ca1, 5);
	ASingleShape s2 = new Square(ca2, 10);
	ASingleShape s3 = new Square(ca3, 12);

	ASingleShape r1 = new Rectangle(ca1, 2, 3);
	ASingleShape r2 = new Rectangle(ca2, 3, 4);
	ASingleShape r3 = new Rectangle(ca3, 2, 1);
	
	
		
	

	public void testArea() {
		assertEquals(d1.area(), 0.0, 0.01);
		assertEquals(cr1.area(), 78.5, 0.1);
		assertEquals(s1.area(), 25.0, 0.1);
		assertEquals(r1.area(), 6.0, 0.1);
	}

	public void testDistanceTo0() {
		assertEquals(d1.distanceTo0(), 5.0, 0.1);
		assertEquals(cr1.distanceTo0(), 5.0, 0.1);
		assertEquals(s2.distanceTo0(), 13.0, 0.1);
		assertEquals(r3.distanceTo0(), 10.0, 0.1);

		assertEquals(d1.distancoTo(ca3), 5.3, 0.1);
		assertEquals(cr1.distancoTo(ca2), 9.0, 0.1);
		assertEquals(r3.distancoTo(ca1), 5.3, 0.1);
	}

	public void testContains() {
		assertTrue(d1.contains(ca1));
		assertFalse(cr1.contains(ca2));
		assertFalse(cr2.contains(new CartesianPoint(20, 30)));
		assertFalse(s1.contains(new CartesianPoint(12, 10)));
		assertTrue(r3.contains(new CartesianPoint(7, 8)));
	}
public void testBoundingBox(){
	assertTrue(d1.boundingBox().equals(new Rectangle(ca1, 0, 0)));
	assertTrue(s1.boundingBox().equals(new  Rectangle(ca1, 5, 5)));
	assertTrue(r3.boundingBox().equals(new Rectangle(ca3, 2, 1)));
	}


}
